#include "pathmapvisualizer.h"

PathMapVisualizer::PathMapVisualizer(PathMap *map, QGraphicsScene *scene)
    : QGraphicsItem(0,scene)
{
    pathMap = map;
}

void PathMapVisualizer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    painter->setBrush(QBrush(QColor(255,0,0,100)));

    for (int row = 0; row < pathMap->getHeight(); row++)
    {
        for (int col = 0; col < pathMap->getWidth(); col++)
        {
            if (pathMap->IsPointPassable(col,row))
                painter->drawRect(col*10,row*10,10,10);
        }
    }
}

QRectF PathMapVisualizer::boundingRect() const
{
    return scene()->sceneRect();
}
